package blog

var analyzers = []blogAnalyzer{
	&blogAnalyzer1{}, &blogAnalyzer2{}, &blogAnalyzer3{}, &blogAnalyzer4{}, &blogAnalyzer5{},
}

// 分析内容属于哪个专栏
func AnalyzeBlogs(userId int64, title, content string) (blogIds []int64) {
	for _, analyzer := range analyzers {
		if analyzer.IsMatch(userId, title, content) {
			blogIds = append(blogIds, analyzer.GetBlogId())
		}
	}
	return
}

type blogAnalyzer interface {
	GetBlogId() int64
	IsMatch(userId int64, title, content string) bool
}
